<!DOCTYPE html>


<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>登录页面</title>
  <style>
    /* 全局样式 */
    body {
      font-family: 'Arial', sans-serif;
      background: linear-gradient(135deg, #6a11cb, #2575fc);
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100vh;
      margin: 0;
      overflow: hidden;
    }

    /* 登录框样式 */
    .login-container {
      background: rgba(255, 255, 255, 0.9);
      padding: 30px;
      border-radius: 15px;
      box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
      width: 350px;
      text-align: center;
      backdrop-filter: blur(10px);
      animation: fadeIn 1s ease-in-out;
    }

    .login-container h2 {
      margin-bottom: 20px;
      color: #333;
      font-size: 24px;
      font-weight: bold;
    }

    /* 输入框样式 */
    .input-group {
      margin-bottom: 20px;
      text-align: left;
    }

    .input-group label {
      display: block;
      margin-bottom: 8px;
      color: #555;
      font-size: 14px;
      font-weight: 500;
    }

    .input-group input {
      width: 100%;
      padding: 12px;
      border: 1px solid #ddd;
      border-radius: 8px;
      font-size: 16px;
      transition: border-color 0.3s ease, box-shadow 0.3s ease;
    }

    .input-group input:focus {
      border-color: #6a11cb;
      box-shadow: 0 0 8px rgba(106, 17, 203, 0.3);
      outline: none;
    }

    /* 登录按钮样式 */
    .login-button {
      width: 100%;
      padding: 12px;
      background: linear-gradient(135deg, #6a11cb, #2575fc);
      color: #fff;
      border: none;
      border-radius: 8px;
      font-size: 16px;
      font-weight: bold;
      cursor: pointer;
      transition: background 0.3s ease, transform 0.2s ease;
    }

    .login-button:hover {
      background: linear-gradient(135deg, #2575fc, #6a11cb);
      transform: translateY(-2px);
    }

    .login-button:active {
      transform: translateY(0);
    }

    /* 注册链接样式 */
    .register-link {
      margin-top: 15px;
      display: block;
      color: #6a11cb;
      text-decoration: none;
      font-size: 14px;
      transition: color 0.3s ease;
    }

    .login-container a {
      color: #6a11cb;
      text-decoration: none;
      font-size: 14px;
      transition: color 0.3s ease;
    }

    .login-container a:hover {
      color: #2575fc;
      text-decoration: underline;
    }

    /* 背景动画 */
    @keyframes moveBackground {
      0% {
        transform: translateY(0);
      }
      50% {
        transform: translateY(-20px);
      }
      100% {
        transform: translateY(0);
      }
    }

    .background-shapes {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: -1;
      overflow: hidden;
    }

    .background-shapes div {
      position: absolute;
      background: rgba(255, 255, 255, 0.1);
      border-radius: 50%;
      animation: moveBackground 10s infinite ease-in-out;
    }

    .background-shapes div:nth-child(1) {
      width: 200px;
      height: 200px;
      top: 10%;
      left: 5%;
      animation-duration: 12s;
    }

    .background-shapes div:nth-child(2) {
      width: 150px;
      height: 150px;
      top: 60%;
      left: 80%;
      animation-duration: 8s;
    }

    .background-shapes div:nth-child(3) {
      width: 100px;
      height: 100px;
      top: 30%;
      left: 70%;
      animation-duration: 10s;
    }

    /* 页面加载动画 */
    @keyframes fadeIn {
      from {
        opacity: 0;
        transform: translateY(20px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }
    /* 错误弹窗样式 */
    .error-popup {
      display: none; /* 默认隐藏 */
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: rgba(255, 182, 193, 0.9); /* 淡粉色背景 */
      z-index: 1000;
      justify-content: center;
      align-items: center;
    }

    .popup-content {
      background-color: white;
      padding: 20px;
      border-radius: 10px;
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
      text-align: center;
      animation: fadeIn 0.5s ease-in-out; /* 淡入动画 */
    }

    .popup-content p {
      font-size: 1.2rem;
      color: #333;
    }

    .popup-content button {
      margin-top: 15px;
      padding: 10px 20px;
      background-color: #ff6f61; /* 按钮颜色 */
      color: white;
      border: none;
      border-radius: 5px;
      cursor: pointer;
      font-size: 1rem;
    }

    .popup-content button:hover {
      background-color: #ff4a3d; /* 按钮悬停颜色 */
    }

    /* 淡入动画 */
    @keyframes fadeIn {
      from {
        opacity: 0;
        transform: translateY(-20px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }
  </style>
</head>
<body>
<div class="login-container">
  <h2>登录</h2>
  <form action="/login" method="post">
    <div class="input-group">
      <label for="username">用户名</label>
      <input type="text" id="username" name="username" placeholder="请输入用户名" required>
    </div>
    <div class="input-group">
      <label for="password">密码</label>
      <input type="password" id="password" name="password" placeholder="请输入密码" required>
    </div>
    <button type="submit" class="login-button">登录</button>
  </form>
  <a href="/login/register.html" class="register-link">没有账号？立即注册</a>
</div>
<!-- 错误弹窗 -->
<div id="error-popup" class="error-popup">
  <div class="popup-content">
    <p id="error-message"></p>
    <button id="close-popup">我知道了</button>
  </div>
</div>
<script>
  // 解析 URL 参数
  const urlParams = new URLSearchParams(window.location.search);
  const error = urlParams.get('error');

  // 获取弹窗和按钮元素
  const errorPopup = document.getElementById('error-popup');
  const closePopupButton = document.getElementById('close-popup');

  // 如果 error=true，显示弹窗
  if (error === 'true') {
    errorPopup.style.display = 'flex'; // 显示弹窗
    document.getElementById('error-message').innerText = '用户名或密码错误';
  }

  // 点击“我知道了”按钮，关闭弹窗
  closePopupButton.addEventListener('click', () => {
    errorPopup.style.display = 'none'; // 隐藏弹窗
  });
</script>
</body>
</html>







